<?php

define( 'INITTIME', microtime(1) );
define( 'MEDIAWIKI', 1 );

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
if ( !in_array( md5( @$_SERVER['REMOTE_ADDR'] ),  PrivateConfiguration::$allowedIPs ) )
{
  header( 'Location: ' . str_replace( '/api_dev.php', '/api.php', "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ) );
  die('You are not allowed to access this file. Replace "api_dev.php" in the URL with "api.php".');
}

$IP = dirname(__FILE__) . '/api';
require_once( "$IP/includes/ProfilerStub.php" );
require_once( "$IP/includes/Defines.php" );
require_once( "$IP/includes/DefaultSettings.php" );
require_once( "$IP/includes/AutoLoader.php" );
require_once( "$IP/includes/Setup.php" );

$configuration = ProjectConfiguration::getApplicationConfiguration('api', 'dev', true);
sfContext::createInstance($configuration)->dispatch();

